<h1>
	<?php 
		echo Yii::t('main', 'auto_direct_payment').' '.Transaction::getType($deposit['type']);
	?>
</h1>
<hr>
<div class="form">
	<fieldset style="text-align:left">
		<div align="center">
			<?php echo CHtml::image($this->baseUrl.'/images/PleaseWait.gif');?>
		</div>
		<!-- PM -->
		<?php if($deposit['type'] == 'pm'):
			$account = AccountPMReceive();
			$comment = Yii::t('main', 'add_coin').'-'.$deposit['code_deposit'].'-'.number_format($deposit['amount_receive'], 0, ',', '.');
		?>
		<form name="payment" action="https://perfectmoney.com/api/step1.asp" method="POST">
			<input type="hidden" name="PAYEE_ACCOUNT" value="<?php echo $account['acc'];?>" />
			<input type="hidden" name="PAYEE_NAME" value="<?php echo $account['store'];?>" />
			<input type="hidden" name="PAYMENT_ID" value="<?php echo $deposit['time'];?>" />
			<input type="hidden" name="PAYMENT_AMOUNT" value="<?php echo $deposit['amount_transfer'];?>" />
			<input type="hidden" name="PAYMENT_UNITS" value="USD" />
			<input type="hidden" name="PAYMENT_URL" value="<?php echo $this->baseUrl.'/bank/successPM';?>" />
			<input type="hidden" name="PAYMENT_URL_METHOD" value="POST" />
			<input type="hidden" name="NOPAYMENT_URL" value="<?php echo $this->baseUrl.'/bank/failPayment';?>" />
			<input type="hidden" name="NOPAYMENT_URL_METHOD" value="POST" />
			<input type="hidden" name="SUGGESTED_MEMO" value="<?php echo $comment;?>" />
		</form>
		<?php endif;?>
		<!-- WMZ -->
		<?php if($deposit['type'] == 'wmz'):
			$account = AccountWMZReceive();
			$comment = Yii::t('main', 'add_coin').'-'.$deposit['code_deposit'].'-'.number_format($deposit['amount_receive'], 0, ',', '.');
		?>
		<form action="https://merchant.wmtransfer.com/lmi/payment.asp" method="post" name="payment" id="payment">
			<input type="hidden" value="<?php echo $deposit['amount_transfer'];?>" name="LMI_PAYMENT_AMOUNT"/>  
			<input type="hidden" value="<?php echo $account['payeePurse'];?>" name="LMI_PAYEE_PURSE"/>
			<input type="hidden" value="0" name="LMI_SIM_MODE"/>
			<input type="hidden" name="LMI_PAYMENT_DESC" value="<?php echo $comment;?>" />
			<input type="hidden" name="LMI_RESULT_URL" value="<?php echo $this->baseUrl.'/bank/successWMZ';?>" />
			<input type="hidden" name="LMI_SUCCESS_URL" value="<?php echo $this->baseUrl.'/bank/successPayment';?>" />
			<input type="hidden" name="LMI_SUCCESS_METHOD" value="2" />
			<input type="hidden" name="LMI_FAIL_URL" value="<?php echo $this->baseUrl.'/bank/failPayment';?>" />
			<input type="hidden" name="LMI_FAIL_METHOD" value="2" />
			<input type="hidden" value="<?php echo $deposit['time'];?>" name="Date"/>
		</form>
		<?php endif;?>
		<!-- BK -->
		<?php if($deposit['type'] == 'bk'):
			$account = AccountBKReceive();
			$comment = Yii::t('main', 'add_coin').'-'.$deposit['code_deposit'].'-'.number_format($deposit['amount_receive'], 0, ',', '.');
			$business = $account['acc'];
			$total_amount = $deposit['amount_transfer'];
			$order_description = $comment;
			$shipping_fee = 0;
			$tax_fee = 0;
			$url_success = $this->baseUrl.'/bank/successBK';
			$url_cancel = $this->baseUrl.'/bank/failPayment';
			$url_detail = '';
			$baokim = new BaoKimPayment();
			$request_url = $baokim->createRequestUrl($deposit['time'], $business, $total_amount, $shipping_fee, $tax_fee, $order_description, $url_success, $url_cancel, $url_detail);
			echo '<script>window.location.href="'.$request_url.'";</script>';
			endif;
		?>
		<!-- NL -->
		<?php 
			if($deposit['type'] == 'nl'):
				$order_id = $deposit['time'];
				//Tài khoản nhận tiền
				$account = AccountNlReceive();
				$receiver = $account['acc'];
				//Khai báo url trả về 
				$return_url = $this->baseUrl.'/bank/successNL';
				//Giá của cả giỏ hàng 
				$price = $deposit['amount_transfer'];
				//Mã giỏ hàng 
				$order_code = 'Giao dịch: ' . $order_id;
				//Thông tin giao dịch
				$transaction_info = Yii::t('main', 'add_coin').'-'.$deposit['code_deposit'].'-'.number_format($deposit['amount_receive'], 0, ',', '.');
			    //Khai báo đối tượng của lớp NL_Checkout
				$nl= new NganLuongPayment();
				//Tạo link thanh toán đến nganluong.vn
				$url= $nl->buildCheckoutUrl($return_url, $receiver, $transaction_info,  $order_code, $price);
				echo '<script>window.location.href="'.$url.'";</script>';
			endif;
		?>
	</fieldset>
</div>
<?php 
	if($deposit['type'] == 'pm' || $deposit['type'] == 'wmz') {
?>
<script>
setTimeout("action()", 5000);
function action() {
	document.payment.submit();
}
</script>
<?php }?>